/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.mzk.rehan.commons;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 *
 * @author Martin Rehanek (rehan@mzk.cz)
 */
public class FileUtils {

    public static void saveDataToFile(byte[] data, File outFile) throws IOException {
        FileOutputStream out = new FileOutputStream(outFile);
        out.write(data);
        out.flush();
        out.close();
    }

    public static byte[] loadDataFromFile(File file) throws IOException {
        FileInputStream fin = new FileInputStream(file);
        byte[] fileContent = new byte[(int) file.length()];
        fin.read(fileContent);
        return fileContent;
    }
}
